home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / imap-3.0 / non-ANSI / c-client / imap2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-19  |  6.5 KB  |  215 lines

  1. /*
  2.  * Program:    Interactive Mail Access Protocol 2 (IMAP2) routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    15 June 1988
  13.  * Last Edited:    19 June 1993
  14.  *
  15.  * Sponsorship:    The original version of this work was developed in the
  16.  *        Symbolic Systems Resources Group of the Knowledge Systems
  17.  *        Laboratory at Stanford University in 1987-88, and was funded
  18.  *        by the Biomedical Research Technology Program of the National
  19.  *        Institutes of Health under grant number RR-00785.
  20.  *
  21.  * Original version Copyright 1988 by The Leland Stanford Junior University
  22.  * Copyright 1993 by the University of Washington
  23.  *
  24.  *  Permission to use, copy, modify, and distribute this software and its
  25.  * documentation for any purpose and without fee is hereby granted, provided
  26.  * that the above copyright notices appear in all copies and that both the
  27.  * above copyright notices and this permission notice appear in supporting
  28.  * documentation, and that the name of the University of Washington or The
  29.  * Leland Stanford Junior University not be used in advertising or publicity
  30.  * pertaining to distribution of the software without specific, written prior
  31.  * permission.  This software is made available "as is", and
  32.  * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
  33.  * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
  34.  * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  35.  * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
  36.  * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
  37.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39.  * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
  40.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  *
  42.  */
  43.  
  44. /* Parameters */
  45.  
  46. #define MAXLOGINTRIALS 3    /* maximum number of login trials */
  47. #define SET_MAXLOGINTRIALS 100
  48. #define GET_MAXLOGINTRIALS 101
  49. #define MAPLOOKAHEAD 20        /* fetch lookahead */
  50. #define SET_LOOKAHEAD 102
  51. #define GET_LOOKAHEAD 103
  52. #define IMAPTCPPORT 143        /* assigned TCP contact port */
  53. #define SET_PORT 104
  54. #define GET_PORT 105
  55.  
  56.  
  57. /* IMAP2 specific definitions */
  58.  
  59.  
  60. /* Parsed reply message from imap_reply */
  61.  
  62. typedef struct imap_parsed_reply {
  63.   char *line;            /* original reply string pointer */
  64.   char *tag;            /* command tag this reply is for */
  65.   char *key;            /* reply keyword */
  66.   char *text;            /* subsequent text */
  67. } IMAPPARSEDREPLY;
  68.  
  69.  
  70. #define IMAPTMPLEN 16*MAILTMPLEN
  71.  
  72. /* IMAP2 I/O stream local data */
  73.  
  74. typedef struct imap_local {
  75.   void *tcpstream;        /* TCP I/O stream */
  76.   IMAPPARSEDREPLY reply;    /* last parsed reply */
  77.   unsigned int use_body : 1;    /* server supports structured bodies */
  78.   unsigned int use_find : 1;    /* server supports FIND command */
  79.   unsigned int use_bboard : 1;    /* server supports BBOARD command */
  80.   unsigned int use_purge : 1;    /* server supports PURGE command */
  81.   char *prefix;            /* find prefix */
  82.   char tmp[IMAPTMPLEN];        /* temporary buffer */
  83. } IMAPLOCAL;
  84.  
  85.  
  86. /* Convenient access to local data */
  87.  
  88. #define LOCAL ((IMAPLOCAL *) stream->local)
  89.  
  90. /* Coddle certain compilers' 6-character symbol limitation */
  91.  
  92. #ifdef __COMPILER_KCC__
  93. #define map_valid ivalid
  94. #define map_parameters iparam
  95. #define map_find ifind
  96. #define map_find_bboards ifindb
  97. #define map_find_all ifnda
  98. #define map_find_all_bboards ifndab
  99. #define map_subscribe isubsc
  100. #define map_unsubscribe iunsub
  101. #define map_subscribe_bboard isubbb
  102. #define map_unsubscribe_bboard iusbbb
  103. #define map_create icreat
  104. #define map_delete idelet
  105. #define map_rename irenam
  106. #define map_manage imanag
  107. #define map_open iopen
  108. #define map_close iclose
  109. #define map_fetchfast iffast
  110. #define map_fetchflags ifflags
  111. #define map_fetchstructure ifenv
  112. #define map_fetchheader ifhead
  113. #define map_fetchtext iftext
  114. #define map_fetchbody ifbody
  115. #define map_setflag isflag
  116. #define map_clearflag icflag
  117. #define map_search isearch
  118. #define map_ping iping
  119. #define map_check icheck
  120. #define map_expunge iexpun
  121. #define map_copy icopy
  122. #define map_move imove
  123. #define map_append iappnd
  124. #define map_gc igc
  125. #define map_do_gc idogc
  126. #define map_gc_body igcb
  127.  
  128. #define imap_host imhost
  129. #define imap_select imsele
  130. #define imap_send imsend
  131. #define imap_send_literal imsndl
  132. #define imap_reply imrepl
  133. #define imap_parse_reply imprep
  134. #define imap_fake imfake
  135. #define imap_OK imok
  136. #define imap_parse_unsolicited impuns
  137. #define imap_parse_flaglst impflg
  138. #define imap_searched imsear
  139. #define imap_expunged imexpu
  140. #define imap_parse_data impdat
  141. #define imap_parse_prop imppro
  142. #define imap_parse_envelope impenv
  143. #define imap_parse_adrlist impadl
  144. #define imap_parse_address impadr
  145. #define imap_parse_flags impfla
  146. #define imap_parse_sys_flag impsfl
  147. #define imap_parse_user_flag impufl
  148. #define imap_parse_string impstr
  149. #define imap_parse_number impnum
  150. #define imap_parse_enclist impecl
  151. #define imap_parse_encoding impenc
  152. #define imap_parse_body impbod
  153. #define imap_parse_body_structure impbst
  154. #endif
  155.  
  156. /* Function prototypes */
  157.  
  158. DRIVER *map_valid  ();
  159. void *map_parameters  ();
  160. void map_find  ();
  161. void map_find_bboards  ();
  162. void map_find_all  ();
  163. void map_find_all_bboards  ();
  164. long map_subscribe  ();
  165. long map_unsubscribe  ();
  166. long map_subscribe_bboard  ();
  167. long map_unsubscribe_bboard  ();
  168. long map_create  ();
  169. long map_delete  ();
  170. long map_rename  ();
  171. long map_manage  ();
  172. MAILSTREAM *map_open  ();
  173. void map_close  ();
  174. void map_fetchfast  ();
  175. void map_fetchflags  ();
  176. ENVELOPE *map_fetchstructure  ();
  177. char *map_fetchheader  ();
  178. char *map_fetchtext  ();
  179. char *map_fetchbody  ();
  180. void map_setflag  ();
  181. void map_clearflag  ();
  182. void map_search  ();
  183. long map_ping  ();
  184. void map_check  ();
  185. void map_expunge  ();
  186. long map_copy  ();
  187. long map_move  ();
  188. long map_append  ();
  189. void map_gc  ();
  190. void map_do_gc  ();
  191. void map_gc_body  ();
  192.  
  193. char *imap_host  ();
  194. IMAPPARSEDREPLY *imap_send  ();
  195. IMAPPARSEDREPLY *imap_send_literal  ();
  196. IMAPPARSEDREPLY *imap_reply  ();
  197. IMAPPARSEDREPLY *imap_parse_reply  ();
  198. IMAPPARSEDREPLY *imap_fake  ();
  199. long imap_OK  ();
  200. void imap_parse_unsolicited  ();
  201. void imap_parse_flaglst  ();
  202. void imap_searched  ();
  203. void imap_expunged  ();
  204. void imap_parse_data  ();
  205. void imap_parse_prop  ();
  206. void imap_parse_envelope  ();
  207. ADDRESS *imap_parse_adrlist  ();
  208. ADDRESS *imap_parse_address  ();
  209. void imap_parse_flags  ();
  210. void imap_parse_user_flag  ();
  211. char *imap_parse_string  ();
  212. unsigned long imap_parse_number  ();
  213. void imap_parse_body  ();
  214. void imap_parse_body_structure  ();
  215.